﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ChildMemu.aspx.cs" Inherits="LongSpeed.WebSite.Main.ChildMemu" %>

<%@ Register Namespace="Ext.Net" Assembly="Ext.Net" TagPrefix="ext" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>久速科技 — 子菜单管理 </title>
    <script src="../../Scripts/admindesktop.js" type="text/javascript"></script>
    <script src="../../../Scripts/ueditor/editor_config.js" type="text/javascript"></script>
    <script src="../../../Scripts/ueditor/editor_all.js" type="text/javascript"></script>
    <link href="../../../Scripts/ueditor/themes/default/ueditor.css" rel="stylesheet" type="text/css" />
    <ext:ResourceManager ID="ResourceManager1" runat="server" />
</head>
<body>
    <form id="form1" runat="server">    
    <ext:Viewport runat="server" ID="vpChildMemu" Layout="BorderLayout">
        <Items>
            <ext:Panel Region="North" runat="server" ID="plParentMemu" BaseCls="x-plain" />
            <ext:GridPanel ID="MemuGridPanel" runat="server" Region="Center" Height="400">
                <Store>
                    <ext:Store ID="ChildMemuStore" runat="server" OnRefreshData="RefreshChildMemuData">
                        <Reader>
                            <ext:JsonReader>
                                <Fields>
                                    <ext:RecordField Name="ID" Type="Int" />
                                    <ext:RecordField Name="Name" Type="String" />
                                    <ext:RecordField Name="Description" Type="String" />
                                    <ext:RecordField Name="IsShow" Type="Boolean" />
                                    <ext:RecordField Name="Memo" Type="String" />
                                    <ext:RecordField Name="ParentId" Type="Auto" />
                                    <ext:RecordField Name="SortIndex" Type="Int" />
                                    <ext:RecordField Name="AlternateField1" Type="String" />
                                    <ext:RecordField Name="AlternateField2" Type="String" />
                                    <ext:RecordField Name="AlternateField3" Type="String" />
                                    <ext:RecordField Name="AlternateField4" Type="String" />
                                    <ext:RecordField Name="AlternateField5" Type="Boolean" />
                                    <ext:RecordField Name="AlternateField6" Type="String" />
                                </Fields>
                            </ext:JsonReader>
                        </Reader>
                        <BaseParams>
                            <ext:Parameter Name="ParentId" Value="aaa" />
                        </BaseParams>
                    </ext:Store>
                </Store>
                <ColumnModel ID="ColumnModel2" runat="server">
                    <Columns>
                        <ext:RowNumbererColumn />
                        <ext:Column Header="名称" DataIndex="Name" Width="200" />
                        <%--<ext:Column Header="描述" DataIndex="Description" Width="200" Hidden="true" /> --%>
                        <ext:CheckColumn Header="是否显示" DataIndex="IsShow" Width="80" />
                        <ext:Column Header="排序索引" DataIndex="SortIndex" Width="80" />
                        <%--<ext:Column Header="硬件说明" DataIndex="Memo" Width="150" Hidden="true" /> --%> 
                        <ext:CheckColumn Header="显示服务器列表" DataIndex="AlternateField5" Width="150" />
                       <ext:Column Header="服务器配置标题" DataIndex="AlternateField1" Width="150" />
                        <ext:Column Header="说明标题" DataIndex="AlternateField2" Width="150" />
                        <ext:Column Header="Url路径" DataIndex="AlternateField3" Width="150" />
                        <ext:CommandColumn Width="180" Header="操作">
                            <Commands>
                                <ext:GridCommand Icon="ServerWrench" CommandName="ShowServer" Text="服务器" />
                                <ext:GridCommand Icon="NoteEdit" CommandName="Edit" Text="编辑" />
                                <ext:GridCommand Icon="Delete" CommandName="Delete" Text="删除" />
                            </Commands>
                        </ext:CommandColumn>
                    </Columns>
                </ColumnModel>
                <SelectionModel>
                    <ext:RowSelectionModel ID="RowSelectionModel4" runat="server" SingleSelect="true">
                    </ext:RowSelectionModel>
                </SelectionModel>
                <LoadMask ShowMask="true" Msg="正在加载数据……" />
                <TopBar>
                    <ext:Toolbar ID="Toolbar4" runat="server">
                        <Items>
                            <ext:ToolbarFill ID="ToolbarFill4" runat="server" />
                            <ext:Button ID="Button23" runat="server" Text="新建" Icon="Add">
                                <Listeners>
                                    <Click Handler="NewData(EditMemuFrom,EditMemuWin,MemuGridPanel)" />
                                </Listeners>
                            </ext:Button>
                        </Items>
                    </ext:Toolbar>
                </TopBar>
                <BottomBar>
                    <ext:PagingToolbar ID="PagingToolbar2" runat="server" PageSize="25">
                        <Items>
                            <ext:ToolbarSpacer ID="ToolbarSpacer7" runat="server" Width="10" />
                            <ext:Label ID="Label4" runat="server" Text="分页大小:" />
                            <ext:ToolbarSpacer ID="ToolbarSpacer8" runat="server" Width="5" />
                            <ext:ComboBox ID="ComboBox4" runat="server" Width="80">
                                <Items>
                                    <ext:ListItem Text="10" />
                                    <ext:ListItem Text="15" />
                                    <ext:ListItem Text="25" />
                                </Items>
                                <SelectedItem Value="10" />
                                <Listeners>
                                    <Select Handler="#{PagingToolbar2}.pageSize = parseInt(this.getValue()); #{PagingToolbar2}.doLoad();" />
                                </Listeners>
                            </ext:ComboBox>
                        </Items>
                    </ext:PagingToolbar>
                </BottomBar>
                <Listeners>
                    <Command Handler="GridPanelRowCommand(this,command, record,EditMemuFrom,EditMemuWin,vpChildMemu);" />
                </Listeners>
            </ext:GridPanel>
        </Items>
    </ext:Viewport>
    <ext:Window runat="server" ID="EditMemuWin" Title="菜单 - 编辑/详情" Icon="Pencil" Modal="true"
        Maximized="true" Hidden="true" AutoScroll="true">
        <Content>
            <ext:FormPanel ID="EditMemuFrom" Frame="true" Layout="FormLayout" Region="Center"
                runat="server" Padding="10" LabelAlign="Right">
                <Items>
                    <ext:TextField runat="server" DataIndex="ParentId" Hidden="true" Text="0" />
                    <ext:TextField runat="server" FieldLabel="名称" DataIndex="Name" AnchorHorizontal="100%" />
                    <ext:Checkbox runat="server" FieldLabel="显示服务器列表" DataIndex="AlternateField5" />
                    <ext:TextField runat="server" FieldLabel="服务器配置标题" DataIndex="AlternateField1" AnchorHorizontal="100%" Text="服务器配置" />
                    <ext:TextField runat="server" FieldLabel="说明标题" DataIndex="AlternateField2" AnchorHorizontal="100%" Text="硬件说明/相关信息" />
                    <ext:TextField runat="server" FieldLabel="Url路径" DataIndex="AlternateField3" AnchorHorizontal="100%"  Regex="^[a-z0-9A-Z]+[_\-]?[a-z0-9A-Z]+.html$" BlankText="输入Url格式不正确" />
                    <ext:TextField runat="server" FieldLabel="Url路径" DataIndex="AlternateField4" AnchorHorizontal="100%" Hidden="true" />
                    <ext:TextField runat="server" FieldLabel="排序索引" DataIndex="SortIndex" Regex="^[0-9]\d*$" AnchorHorizontal="100%" DefaultAnchor="0" />
                    <ext:Checkbox runat="server" FieldLabel="是否显示" DataIndex="IsShow" />
                    <ext:TextArea runat="server" FieldLabel="描述" DataIndex="Description" ID="desEditor" AutoScroll="false" AnchorHorizontal="100%" Height="410" />
                    <ext:TextArea runat="server" FieldLabel="硬件说明" DataIndex="Memo" AnchorHorizontal="100%" ID="memoEditor" AutoScroll="false" Height="320" />
                </Items>
            </ext:FormPanel>
        </Content>
        <Buttons>
            <ext:Button ID="Button17" runat="server" Text="保存" Icon="Disk">
                <Listeners>
                    <Click Handler="#{EditMemuFrom}.getForm().updateRecord(EditMemuFrom.record); SaveData(2,EditMemuFrom,false,EditMemuWin,MemuGridPanel) ;" />
                </Listeners>
            </ext:Button>
            <ext:Button ID="Button18" runat="server" Text="新建" Icon="UserAdd">
                <Listeners>
                    <Click Handler="SaveData(2,EditMemuFrom,true,EditMemuWin,MemuGridPanel) ;" />
                </Listeners>
            </ext:Button>
            <ext:Button ID="Button19" runat="server" Text="重置">
                <Listeners>
                    <Click Handler="#{EditMemuFrom}.getForm().reset();" />
                </Listeners>
            </ext:Button>
        </Buttons>
    </ext:Window>
    <script type="text/javascript">
        var desEditor;
        var memoEditor;

        Ext.onReady(function () {
            var editor = baidu.editor.ui.Editor({
                textare: "myValue"
            });
            editor.render("desEditor");
            desEditor = editor;


            var memo = baidu.editor.ui.Editor();
            memo.render("memoEditor");
            memoEditor = memo;
        });



        //获得 editor.getContent()
        //赋值 editor.setContent("")

    </script>
    </form>
</body>
</html>
